$(function(){
				//需要传递进来一张二维码
				var data =new Array($("#big_bg").val(),$("#qr").val());
			    showQr(data);
			})
//关闭说明
function popboxclose(){	
	$('#explainpop').css("visibility","hidden");
}
//玩法说明
function explain(){	
	$('#explainpop').css("visibility","visible");
}

//关闭奖励
function awardpopclose(){	
	$('#awardpop').css("visibility","hidden");
}
//奖励机制
function lookBack(){	
	$('#awardpop').css("visibility","visible");
}
//成为代理
function becomeagency(){
	//printLog("成为代理");
	$('#becomeagencypop').css("visibility","visible");
}
function becomeagencypopclose(){
	$('#becomeagencypop').css("visibility","hidden");
}



function showQr(data1) {

	var img = new Image();
	img.setAttribute('crossOrigin', 'anonymous');
	img.onload = function() {
		var obj = this;

		draw(obj.width, obj.height, data1);
	};
	img.onerror = function() {
	};
	img.src = data1[0];
}

function draw(w, h, data1) {

	var maxwidth = document.body.offsetWidth - 20;
	if(maxwidth < 100) {
		maxwidth = 300;
	}
	if(maxwidth > 400) {
		maxwidth = 360;
	}
	var c = document.createElement('canvas'),
		ctx = c.getContext('2d'),
		len = data1.length;
	c.width = maxwidth;
	c.height = maxwidth * h / w;
	ctx.rect(0, 0, c.width, c.height);
	ctx.fillStyle = 'transparent'; //画布填充颜色
	ctx.fill();

	function drawing(n) {

		if(n < len) {
			var img = new Image;
			img.setAttribute('crossOrigin', 'anonymous');
			img.src = data1[n];
			img.onload = function() {
				if(n == 0) {
					ctx.drawImage(img, 0, 0, c.width, c.height);
				} else {
					var leftw = (c.width - c.width * 0.5) / 2;
					var topw = (c.height - c.width * 0.5) / 1.4;;
					//ctx.drawImage(img, leftw, topw, c.width * 0.6, c.width * 0.6);
					ctx.drawImage(img, leftw, topw, c.width * 0.5, c.width * 0.5);
				}

				drawing(n + 1); //递归
			}
		} else {
			//保存生成作品图片
			convertCanvasToImage(c);
			//Canvas2Image.saveAsJPEG(c); //保存到电脑
		}
	}
	drawing(0);
}

function convertCanvasToImage(canvas) {
	var hc_image = new Image();
	hc_image.setAttribute('crossOrigin', 'anonymous');
	hc_image.src = canvas.toDataURL("image/png");
	//$('#imgBox').html(hc_image);
	//printLog("进来了"+hc_image);
	//printLog("进来了++++++"+canvas.toDataURL("image/png"));
	//var aaa = "url("+canvas.toDataURL("image/png")+")";
    $('#section').attr("src",canvas.toDataURL("image/png"));
}